using System;

namespace Admin.NET.Application.Service.Report.Dto;

public class EneryReport
{
	/// <summary>
	/// 表名称
	/// </summary>
	public string MeterName { get; set; }

	/// <summary>
	/// 表编号
	/// </summary>
	public string MeterNo { get; set; }

	/// <summary>
	/// 当前电量
	/// </summary>
	public string NowPower { get; set; }

	/// <summary>
	/// 上月电量
	/// </summary>
	public string LastPower { get; set; }

	/// <summary>
	/// 新增电量
	/// </summary>
	public string AddPower
	{
		get
		{
			decimal nowPower = default(decimal);
			decimal lastPower = default(decimal);
			decimal.TryParse(NowPower, out nowPower);
			decimal.TryParse(LastPower, out lastPower);
			decimal addValue = lastPower - nowPower;
			return Math.Round(addValue, 2).ToString() ?? "";
		}
	}

	/// <summary>
	/// 新增Co2
	/// </summary>
	public string AddCo2 => Math.Round(Convert.ToDecimal(AddPower) * 0.997m, 2).ToString() ?? "";

	/// <summary>
	/// 比值
	/// </summary>
	public string Specific
	{
		get
		{
			decimal lastPower = default(decimal);
			decimal.TryParse(LastPower, out lastPower);
			if (lastPower == 0m)
			{
				return "--";
			}
			decimal addPower = Convert.ToDecimal(AddPower);
			if (addPower == 0m)
			{
				return "--";
			}
			return Math.Round(addPower / lastPower * 100m, 2).ToString() ?? "";
		}
	}
}
